package com.santu.edu.supporter.biz.user.service.impl;

import com.santu.edu.supporter.biz.user.dao.UserDao;
import com.santu.edu.supporter.biz.user.pojo.dto.UserDTO;
import com.santu.edu.supporter.biz.user.pojo.params.UserUpdateParam;
import com.santu.edu.supporter.biz.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author 12158
 */
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserDao userDao;

    @Override
    public Boolean addUser(String userId) {
        UserDTO dto = UserDTO.createItem(userId);
        userDao.addUser(dto);
        return true;
    }

    @Override
    public Boolean updateUser(UserUpdateParam updateParam) {
        UserDTO dto = UserDTO.createItem(updateParam);
        userDao.updateUser(dto);
        return true;
    }

    @Override
    public Boolean removeUser(String userId) {
        userDao.removeUser(userId);
        return true;
    }

    @Override
    public UserDTO getUserById(String userId) {
        return userDao.getUserById(userId);
    }
}
